has_ticket = True
knife_length = 30
if knife_length <=20:
    print('安检通过,请前往检票')
    if has_ticket:
        print('通过,请上车')
    else:
        print(('检票失败,不通过'))
else:
    #print(f'警告!携带刀的长度为:{knife_length}cm,大于20cm,请退出!')
    print('警告!携带刀的长度为:%scm,大于20cm,请退出!' % knife_length)